define([], function() {
	return{
		title:['<a href="user.html">个人中心</a>', "商城管理", "首页轮播图管理"],
		init:function(content){
			
		}
	}
});	

var bntimg = $("#_bntimg");
var progress = $(".progress");

let froms = $(".form-horizontal._uploadForm");

console.info(froms);

froms.on("submit", function() {
	let formData = new FormData(forms[0]);
	
	progress.show();
	$.ajax({
		type: "post",
		url: "shop/slide-photo.do",
		processData: false, // 不会将 data 参数序列化字符串
		contentType: false, // 根据表单 input 提交的数据使用其默认的 contentType
		data: formData,
		success: function(data) {
			if(data.ok) {
				toastr.success("修改成功");
				$(".modal").modal('hide');
				form.trigger("reset");
			} else {
				toastr.error(data.message);
			}
		},
		dataType: "json",
		
	});
	//return false;
});



bntimg.find("._img").on("click", function() {
	$(this).prev().trigger("click");
	return false;
});

var imgFile = bntimg.find(":file[name='img']");
var img = $("#imgShow");

imgFile.on("change", function() {
	var f = imgFile[0].files[0];
	console.info(f);
	var reader = new FileReader();
	reader.onload = function() {
		//		alert("aa");
		img[0].src = reader.result;
	}
	reader.readAsDataURL(f);
});

bntimg.on("reset", function() {
	img[0].src = "img/_noimg.png";
});


